/*
 * Copyright (C) 2008 Alessandro Sivieri <alessandro.sivieri@chimera-bellerofonte.eu>.
 *
 *  This file is part of Daex.
 *
 *  Daex is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Foobar is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 */
package eu.chimera_bellerofonte.tesi.datatypes;

import java.io.Serializable;

/**
 * Questo enum descrive tutti gli 80 generi di musica contemplati dalla versione tag mp3 id3v1.
 * @author  Sivieri Alessandro
 * @author  Vitucci Nicola
 * @version  20/apr/07
 */
public enum Genre implements Serializable
{
	BLUES(0, "Blues"), CLASSIC_ROCK(1, "Classic Rock"), COUNTRY(2, "Country"), DANCE(3, "Dance"), DISCO(4, "Disco"), 
	FUNK(5, "Funk"), GRUNGE(6, "Grunge"), HIP_HOP(7, "Hip hop"), JAZZ(8, "Jazz"), METAL(9, "Metal"),
	NEW_AGE(10, "New age"), OLDIES(11, "Oldies"), OTHER(12, "Other"), POP(13, "Pop"), R_AND_B(14, "Rythm n' blues"),
	RAP(15, "Rap"), REGGAE(16, "Reggae"), ROCK(17, "Rock"), TECHNO(18, "Techno"), INDUSTRIAL(19, "Industrial"),
	ALTERNATIVE(20, "Alternative"), SKA(21, "Ska"), DEATH_METAL(22, "Death Metal"), PRANKS(23, "Pranks"), SOUNDTRACK(24, "Soundtrack"),
	EURO_TECHNO(25, "Euro techno"), AMBIENT(26, "Ambient"), TRIP_HOP(27, "Trip hop"), VOCAL(28, "Vocal"), JAZZ_FUNK(29, "Jazz funk"),
	FUSION(30, "Fusion"), TRANCE(31, "Trance"), CLASSICAL(32, "Classical"), INSTRUMENTAL(33, "Instrumental"), ACID(34, "Acid"),
	HOUSE(35, "House"), GAME(36, "Game"), SOUND_CLIP(37, "Sound clip"), GOSPEL(38, "Gospel"), NOISE(39, "Noise"),
	ALTERNROCK(40, "Alternative rock"), BASS(41, "Bass"), SOUL(42, "Soul"), PUNK(43, "Punk"), SPACE(44, "Space"),
	MEDITATIVE(45, "Meditative"), INSTRUMENTAL_POP(46, "Instrumental pop"), INSTRUMENTAL_ROCK(47, "Instrumental rock"), ETHNIC(48, "Ethnic"), GOTHIC(49, "Gothic"),
	DARKWAVE(50, "Dark wave"), TECHNO_INDUSTRIAL(51, "Techno industrial"), ELECTRONIC(52, "Electronic"), POP_FOLK(53, "Pop folk"), EURODANCE(54, "Eurodance"),
	DREAM(55, "Dream"), SOUTHERN_ROCK(56, "Southern rock"), COMEDY(57, "Comedy"), CULT(58, "Cult"), GANGSTA(59, "Gangsta"),
	TOP_40(60, "Top 40"), CHRISTIAN_RAP(61, "Christian rap"), POP_FUNK(62, "Pop funk"), JUNGLE(63, "Jungle"), NATIVE_AMERICAN(64, "Native American"),
	CABARET(65, "Cabaret"), NEW_WAVE(66, "New wave"), PSYCHEDELIC(67, "Psychedelic"), RAVE(68, "Rave"), SHOWTUNES(69, "Show tunes"),
	TRAILER(70, "Trailer"), LO_FI(71, "Lo fi"), TRIBAL(72, "Tribal"), ACID_PUNK(73, "Acid punk"), ACID_JAZZ(74, "Acid jazz"),
	POLKA(75, "Polka"), RETRO(76, "Retro'"), MUSICAL(77, "Musical"), ROCK_AND_ROLL(78, "Rock and roll"), HARD_ROCK(79, "Hard rock");
	
	private int index;
	private String name;
	
	Genre(int i, String name)
	{
		this.index=i;
		this.name=name;
	}

	/**
	 * Questo metodo ritorna il valore attuale di index.
	 * @return  il valore attuale di index
	 * @uml.property  name="index"
	 */
	public int getIndex()
	{
		return index;
	}

	/**
	 * Questo metodo setta index con il valore dato.
	 * @param index  il nuovo valore per questo campo
	 * @uml.property  name="index"
	 */
	public void setIndex(int index)
	{
		this.index = index;
	}

	/**
	 * Questo metodo ritorna il valore attuale di name.
	 * 
	 * @return il valore attuale di name
	 */
	public String getName()
	{
		return name;
	}

	/**
	 * Questo metodo setta name con il valore dato.
	 * 
	 * @param name il nuovo valore per questo campo
	 */
	public void setName(String name)
	{
		this.name = name;
	}
	
	public static Genre getGenreByName(String name)
	{
		for(Genre g: Genre.values())
		{
			if(g.getName().equals(name))
			{
				return g;
			}
		}
		return null;
	}
}
